package leetcode_1601_1700;

import node.ListNode;

public class LeeCode_1669 {
    public static void main(String[] args) {

    }
    private static ListNode mergeInBetween(ListNode list1, int a, int b, ListNode list2) {
        int i = 0;
        ListNode dummy = new ListNode(0);
        dummy.next = list1;
        ListNode start = list1;
        while (i < a){
            start = start.next;
            dummy = dummy.next;
            i++;
        }
        ListNode end = start;
        i = a;
        while (i < b){
            end = end.next;
            i++;
        }
        ListNode ee = end.next;
        end.next = null;
        dummy.next = list2;
        ListNode cur = list2;
        while (cur.next != null){
            cur = cur.next;
        }
        cur.next = ee;
        return list1;
    }
}
